# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-localserver
pkgver=0.8.1
_commit=cb062902403e30b0f1b96402f0ba829711da9e55
pkgrel=1
pkgdesc='py.test plugin to test server connections locally'
arch=('any')
license=('MIT')
url='https://github.com/pytest-dev/pytest-localserver'
depends=('python-pytest' 'python-werkzeug')
optdepends=('python-aiosmtpd: for smtp')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel'
             'python-setuptools-scm')
checkdepends=('python-requests')
source=(git+https://github.com/pytest-dev/pytest-localserver.git#commit=$_commit)
sha512sums=('SKIP')

build() {
  cd pytest-localserver
  python -m build -nw
}

check() {
  # Hack entry points by installing it

  cd pytest-localserver
  python -m installer -d tmp_install dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH" pytest
}

package() {
  cd pytest-localserver
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
